package nautilus.lab.activity;

import nautilus.lab.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class TextPageFragment extends Fragment{
	
	public static final String ARG_PAGE = "page";
	private int mPageNumber;
	
	public static TextPageFragment create(int pageNumber){
		TextPageFragment fragment = new TextPageFragment();
		Bundle args = new Bundle();
		args.putInt(ARG_PAGE, pageNumber);
		fragment.setArguments(args);
		
		return fragment;
	}
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPageNumber = getArguments()==null?0:getArguments().getInt(ARG_PAGE);
    }
	
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState){
		
		ViewGroup rootView = (ViewGroup)inflater.inflate(R.layout.slide_view, container, false);
		// Set the title view to show the page number.
        ((TextView) rootView.findViewById(R.id.text1)).setText(String.format("Page %d", mPageNumber + 1));
		return rootView;
	}
	
	public int getPageNumber() {
        return mPageNumber;
    }

}
